<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <title>轮播图效果</title>
    <meta
      name="viewport"
      content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1"
    />
    <script src="./js/jquery.min.js"></script>
    <link rel="stylesheet" href="./css/swiper-bundle.min.css" />

    <style>
      html,
      body {
        position: relative;
        height: 100%;
      }

      body {
        background: #eee;
        font-family: Helvetica Neue, Helvetica, Arial, sans-serif;
        font-size: 14px;
        color: #000;
        margin: 0;
        padding: 0;
      }

      .swiper-container {
        width: 820px;
        height: 332px;
      }
      .swiper-wrapper {
        width: 820px;
        height: 332px;
      }

      .swiper-slide {
        text-align: center;
        font-size: 18px;
        background: #fff;

        /* Center slide text vertically */
        display: -webkit-box;
        display: -ms-flexbox;
        display: -webkit-flex;
        display: flex;
        -webkit-box-pack: center;
        -ms-flex-pack: center;
        -webkit-justify-content: center;
        justify-content: center;
        -webkit-box-align: center;
        -ms-flex-align: center;
        -webkit-align-items: center;
        align-items: center;
      }
    </style>
  </head>
  <body>
    <div class="swiper-container">
      <div class="swiper-wrapper">
        <div class="swiper-slide"><img src="./uploads/轮播1.jpg" alt="" /></div>
        <div class="swiper-slide"><img src="./uploads/轮播2.jpg" alt="" /></div>
        <div class="swiper-slide"><img src="./uploads/轮播3.jpg" alt="" /></div>
        <div class="swiper-slide"><img src="./uploads/轮播4.png" alt="" /></div>
      </div>
      <div class="swiper-pagination"></div>
      <div class="swiper-button-next"></div>
      <div class="swiper-button-prev"></div>
    </div>
    <script src="./js/swiper-bundle.min.js"></script>
    <script>
      //    可以参考  180嵌套 、190抓手光标 、 200无限循环 、 2403D滚动切换 、 310缩略图/无限循环
      //    缩放400 、  虚拟410  、自定义插件420

      var swiper = new Swiper('.swiper-container', {
        spaceBetween: 30, //slide之间的距离
        centeredSlides: true, //若为真，那么活动块会居中，而非默认状态下的居左
        effect: 'cube', //翻转效果
        zoom: true, //缩放图片比例
        mousewheel: true, //鼠标滚动可以控制slide替换
        autoplay: {
          //自动切换
          delay: 2500,
          disableOnInteraction: false,
        },
        pagination: {
          el: '.swiper-pagination',
          clickable: true,
        },
        navigation: {
          nextEl: '.swiper-button-next',
          prevEl: '.swiper-button-prev',
        },
      })
    </script>
  </body>
</html>
